package com.haoze.nurseapp.controller;

import com.haoze.common.response.Result;
import com.haoze.nurseapp.dto.HelpItemParamDTO;
import com.haoze.nurseapp.service.HelperService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RequestMapping("/nurseapp/help")
@RestController
public class HelperController {
    @Autowired
    HelperService helperService;

    @GetMapping("/hisItemDicts")
    @ApiOperation(value = "获取HIS 字典名称：药品剂型、药品特殊病种、药品管理分类、药品特殊药品、材料类别、材料管理分类、材料属性")
    public Result hisItemDicts(@RequestParam String hisDictName) {
        return helperService.queryHisItemDicts(hisDictName);
    }

    @PostMapping("/itemDicts")
    @ApiOperation(value = "检查/检验/处置科室及项目列表")
    public Result itemDicts(@RequestBody HelpItemParamDTO helpItemParam) {
        return helperService.queryItemDicts(helpItemParam);
    }

    @GetMapping("/helpDrugItems")
    @ApiOperation(value = "获取药品帮助字典")
    public Result helpDrugItems(@RequestParam(required = false) String phamForm,
                                @RequestParam(required = false) String illnessCode,
                                @RequestParam(required = false) String secretCode,
                                @RequestParam(required = false) Integer page,
                                @RequestParam(required = false) Integer pageSize,
                                @RequestParam(required = false) String toxicologyProperty,
                                @RequestParam(required = true) String phamStdCode) {
        return helperService.queryHelpDrugItems(phamStdCode, phamForm, illnessCode, secretCode, toxicologyProperty, page, pageSize);
    }

    @GetMapping("/helpMaterialItems")
    @ApiOperation(value = "获取材料帮助字典")
    public Result helpMaterialItems(@RequestParam(required = false) String itemTypeId,
                                    @RequestParam(required = false) String secretCode,
                                    @RequestParam(required = false) String expSx,
                                    @RequestParam(required = true) String outWh,
                                    @RequestParam(required = false) Integer page,
                                    @RequestParam(required = false) Integer pageSize,
                                    @RequestParam(required = true) String itemCode) {
        return helperService.queryHelpMaterialItems(itemCode, itemTypeId, secretCode, expSx, outWh, page, pageSize);
    }


    @GetMapping("/getPriceTable")
    @ApiOperation(value = "获取价表")
    public Result getPriceTable(@RequestParam final String itemClassName,
                                @RequestParam final String itemCode) {
        return helperService.getPriceTable(itemClassName, itemCode);
    }
}
